package com.xm.servlet.reception_desk.order_settlement;


import com.xm.service.reception_desk.AddressService;
import lombok.SneakyThrows;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


/**
 * 选中地址
 * @author 康文程
 * @date 2024-1-8 下午 05:40
 */
@WebServlet("/selected/order/settlement")
public class SelectedOrderSettlementServlet extends HttpServlet {
    /**
     * 地址Service
     */
    private final AddressService service = new AddressService();
    @SneakyThrows(Exception.class)
    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp)  {
        String addressId = req.getParameter("addressId");
        String isSelectedAddress = req.getParameter("isSelectedAddress");
        resp.getWriter().println(service.updateIsSelectedAddress(addressId,Integer.parseInt(isSelectedAddress)));
    }
}
